<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>安防态势-右侧-图表</title>

        <style>
            html,
            body {
                margin: 0;
                padding: 0;
                color: white;
                width: 1px;
                height: 1px;
            }
        </style>
    </head>
    <body>
        <script src="../../config.js"></script>
        <script>
            init()
            function init() {
                let web_token = Fuck('func_db', null, 'get', JSON.stringify({ key: 'web_token', default: '' }))
                let web_projId = Fuck('func_db', null, 'get', JSON.stringify({ key: 'web_projId', default: '' }))
                if (!web_token) {
                    console.error('未获取到token，请检查token是否正确')
                }

                let deviceType = '摄像头'

                // 设备统计
                this.CreateOrSetUIPage2('DeviceViewEquipStatistics', 444, -113, 420, 336, window.iotWebConfig?.designUrl + '?code=component_7Dg3ZYH05D&token=' + web_token + '&projId=' + web_projId, 1)
                // 工单分析
                // this.CreateOrSetUIPage2('SafeViewTypeAlarm', 444, -473, 420, 481, window.iotWebConfig?.designUrl + '?code=component_DKCSrLbc4s&token=' + web_token + '&projId=' + web_projId, 1)
                // 重点设备
                this.CreateOrSetUIPage2(
                    'SafeKeyDevice',
                    444,
                    -473,
                    420,
                    501,
                    window.iotWebConfig?.webUrl + '/pages/common/keyDevice.html?height=501&deviceType=' + deviceType + '&token=' + web_token + '&projId=' + web_projId,
                    1
                )

                // 设备图例
                this.CreateOrSetUIPage2('SafeKeyDeviceLegend', 590, -830, 121, 141, window.iotWebConfig?.designUrl + '?code=component_CZqr5BM0Mz&token=' + web_token + '&projId=' + web_projId, 1)

                // 重点视频画面
                this.CreateOrSetUIPage2('SafeViewTypeAlarm2', -24, -113, 420, 330, window.iotWebConfig?.iotUrl + '/rtspVideoControl.html?name=SP_WW_001&title=重点视频画面', 3)
                // 告警事件
                this.CreateOrSetUIPage2('SafeViewAlarmEvent', -24, -467, 420, 388, window.iotWebConfig?.webUrl + '/pages/common/message.html?height=418&pageType=monitor&token=' + web_token + '&projId=' + web_projId, 3)

                Fuck('func_html_chrome', 'DeviceViewEquipStatistics', 'set_render_sort', 9999)
                Fuck('func_html_chrome', 'SafeKeyDevice', 'set_render_sort', 9999)
                Fuck('func_html_chrome', 'SafeKeyDeviceLegend', 'set_render_sort', 9999)

                Fuck('func_html_chrome', 'SafeViewTypeAlarm2', 'set_render_sort', 9999)
                Fuck('func_html_chrome', 'SafeViewAlarmEvent', 'set_render_sort', 9999)
            }

            // 创建或者设置一个右侧的数据页面
            // 使用了淡入淡出效果
            function CreateOrSetUIPage2(id, x, y, width, height, source, anchor = 3, transform = '1,1') {
                var arg = {
                    id,
                    x,
                    y,
                    width,
                    height,
                    anchor: anchor,
                    source,
                    transform,
                    blur: true,
                    radius: 6,
                    group: '_RDP_',
                    animation: {
                        name: 'fade+transform',
                        from_x: 24
                    }
                }

                Fuck('func_html_chrome', null, 'create_page', JSON.stringify(arg))
            }
        </script>
    </body>
</html>
